<?php
/**
 * count the number of links in the database
 * @returns integer
 * @returns number of links in the database
 */
function reequipment_userapi_checkuserincompany($args)
{
    extract($args);
    $dbconn =& xarDBGetConn();
    $xartable =& xarDBGetTables();

    $table = $xartable['rel_eq'];

    $query = "SELECT COUNT(1)
              FROM $table
              WHERE user_id = ?
              AND company_id = ?";
    $result =& $dbconn->Execute($query, array($user_id, $company_id));
    if (!$result) return;
    list($numitems) = $result->fields;
    $result->Close();
    if ($numitems == 0){
    	$msg = xarML('You are not currently assigned to this company');
        xarErrorSet(XAR_SYSTEM_EXCEPTION, 'BAD_PARAM', new SystemException($msg));
        return;
    }
    return true;
}
?>